import { Grid, GridItem, Toast } from 'react-vant';
import { ShopO } from '@react-vant/icons';
import { useEffect, useState } from 'react';
import { GoodItem } from '@/utils/myinterface';
import { connect } from 'dva';
export default connect(({ index }) => index)((props) => {
  const [goods, setGoods] = useState<Array<GoodItem> | null>(null);
  useEffect(() => {
    setGoods(props.goods);
  }, []);
  return (
    <>
      <Grid columnNum={5}>
        {goods &&
          goods
            .filter((it: GoodItem) => it.type == 'catchSprite')
            .map((i: GoodItem, index: number) => (
              <Grid.Item
                key={index}
                icon={<ShopO />}
                text={i.name + ' ' + i.size}
              />
            ))}
      </Grid>
    </>
  );
});
